(fill-single-word-nobreak-p): Allow breaking before
authorStefan Monnier <monnier@iro.umontreal.ca>
Wed, 6 Sep 2006 16:35:18 +0000 (16:35 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Wed, 6 Sep 2006 16:35:18 +0000 (16:35 +0000)
last word, if it's not the end of the paragraph.

lisp/ChangeLog
lisp/textmodes/fill.el

index ad79e1423a586050583f526695495d68ad451f87..d4adce039df3a25026afe4aafe397f3eb658dd58 100644 (file)
@@ -1,5 +1,8 @@
 2006-09-06  Stefan Monnier  <monnier@iro.umontreal.ca>
 
+       * textmodes/fill.el (fill-single-word-nobreak-p): Allow breaking before
+       last word, if it's not the end of the paragraph.
+
        * files.el (abbreviate-file-name): Don't mistakenly match newlines in
        file name.
 
index 95f73b569521c5b0313457eb5bda07ce24b65403..af97ca83e6e1b089172eb4b8b2b4c1e9c5e981af 100644 (file)
@@ -292,7 +292,9 @@ act as a paragraph-separator."
 
 (defun fill-single-word-nobreak-p ()
   "Don't break a line after the first or before the last word of a sentence."
-  (or (looking-at (concat "[ \t]*\\sw+" "\\(?:" (sentence-end) "\\)"))
+  ;; Actually, allow breaking before the last word of a sentence, so long as
+  ;; it's not the last word of the paragraph.
+  (or (looking-at (concat "[ \t]*\\sw+" "\\(?:" (sentence-end) "\\)[ \t]*$"))
       (save-excursion
        (skip-chars-backward " \t")
        (and (/= (skip-syntax-backward "w") 0)